#pragma once
// MESSAGE SET_PID_ALT PACKING

#define MAVLINK_MSG_ID_SET_PID_ALT 200

MAVPACKED(
typedef struct __mavlink_set_pid_alt_t {
 int16_t speed_pid_p; /*<  speed_pid_p*/
 int16_t speed_pid_i; /*<  speed_pid_i*/
 int16_t speed_pid_d; /*<  speed_pid_d*/
 int16_t stable_pid_p; /*<  stable_pid_p*/
 int16_t stable_pid_i; /*<  stable_pid_i*/
 int16_t stable_pid_d; /*<  stable_pid_d*/
}) mavlink_set_pid_alt_t;

#define MAVLINK_MSG_ID_SET_PID_ALT_LEN 12
#define MAVLINK_MSG_ID_SET_PID_ALT_MIN_LEN 12
#define MAVLINK_MSG_ID_200_LEN 12
#define MAVLINK_MSG_ID_200_MIN_LEN 12

#define MAVLINK_MSG_ID_SET_PID_ALT_CRC 106
#define MAVLINK_MSG_ID_200_CRC 106



#if MAVLINK_COMMAND_24BIT
#define MAVLINK_MESSAGE_INFO_SET_PID_ALT { \
    200, \
    "SET_PID_ALT", \
    6, \
    {  { "speed_pid_p", NULL, MAVLINK_TYPE_INT16_T, 0, 0, offsetof(mavlink_set_pid_alt_t, speed_pid_p) }, \
         { "speed_pid_i", NULL, MAVLINK_TYPE_INT16_T, 0, 2, offsetof(mavlink_set_pid_alt_t, speed_pid_i) }, \
         { "speed_pid_d", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_set_pid_alt_t, speed_pid_d) }, \
         { "stable_pid_p", NULL, MAVLINK_TYPE_INT16_T, 0, 6, offsetof(mavlink_set_pid_alt_t, stable_pid_p) }, \
         { "stable_pid_i", NULL, MAVLINK_TYPE_INT16_T, 0, 8, offsetof(mavlink_set_pid_alt_t, stable_pid_i) }, \
         { "stable_pid_d", NULL, MAVLINK_TYPE_INT16_T, 0, 10, offsetof(mavlink_set_pid_alt_t, stable_pid_d) }, \
         } \
}
#else
#define MAVLINK_MESSAGE_INFO_SET_PID_ALT { \
    "SET_PID_ALT", \
    6, \
    {  { "speed_pid_p", NULL, MAVLINK_TYPE_INT16_T, 0, 0, offsetof(mavlink_set_pid_alt_t, speed_pid_p) }, \
         { "speed_pid_i", NULL, MAVLINK_TYPE_INT16_T, 0, 2, offsetof(mavlink_set_pid_alt_t, speed_pid_i) }, \
         { "speed_pid_d", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_set_pid_alt_t, speed_pid_d) }, \
         { "stable_pid_p", NULL, MAVLINK_TYPE_INT16_T, 0, 6, offsetof(mavlink_set_pid_alt_t, stable_pid_p) }, \
         { "stable_pid_i", NULL, MAVLINK_TYPE_INT16_T, 0, 8, offsetof(mavlink_set_pid_alt_t, stable_pid_i) }, \
         { "stable_pid_d", NULL, MAVLINK_TYPE_INT16_T, 0, 10, offsetof(mavlink_set_pid_alt_t, stable_pid_d) }, \
         } \
}
#endif

/**
 * @brief Pack a set_pid_alt message
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 *
 * @param speed_pid_p  speed_pid_p
 * @param speed_pid_i  speed_pid_i
 * @param speed_pid_d  speed_pid_d
 * @param stable_pid_p  stable_pid_p
 * @param stable_pid_i  stable_pid_i
 * @param stable_pid_d  stable_pid_d
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_set_pid_alt_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
                               int16_t speed_pid_p, int16_t speed_pid_i, int16_t speed_pid_d, int16_t stable_pid_p, int16_t stable_pid_i, int16_t stable_pid_d)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_SET_PID_ALT_LEN];
    _mav_put_int16_t(buf, 0, speed_pid_p);
    _mav_put_int16_t(buf, 2, speed_pid_i);
    _mav_put_int16_t(buf, 4, speed_pid_d);
    _mav_put_int16_t(buf, 6, stable_pid_p);
    _mav_put_int16_t(buf, 8, stable_pid_i);
    _mav_put_int16_t(buf, 10, stable_pid_d);

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SET_PID_ALT_LEN);
#else
    mavlink_set_pid_alt_t packet;
    packet.speed_pid_p = speed_pid_p;
    packet.speed_pid_i = speed_pid_i;
    packet.speed_pid_d = speed_pid_d;
    packet.stable_pid_p = stable_pid_p;
    packet.stable_pid_i = stable_pid_i;
    packet.stable_pid_d = stable_pid_d;

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SET_PID_ALT_LEN);
#endif

    msg->msgid = MAVLINK_MSG_ID_SET_PID_ALT;
    return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_SET_PID_ALT_MIN_LEN, MAVLINK_MSG_ID_SET_PID_ALT_LEN, MAVLINK_MSG_ID_SET_PID_ALT_CRC);
}

/**
 * @brief Pack a set_pid_alt message on a channel
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param chan The MAVLink channel this message will be sent over
 * @param msg The MAVLink message to compress the data into
 * @param speed_pid_p  speed_pid_p
 * @param speed_pid_i  speed_pid_i
 * @param speed_pid_d  speed_pid_d
 * @param stable_pid_p  stable_pid_p
 * @param stable_pid_i  stable_pid_i
 * @param stable_pid_d  stable_pid_d
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_set_pid_alt_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
                               mavlink_message_t* msg,
                                   int16_t speed_pid_p,int16_t speed_pid_i,int16_t speed_pid_d,int16_t stable_pid_p,int16_t stable_pid_i,int16_t stable_pid_d)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_SET_PID_ALT_LEN];
    _mav_put_int16_t(buf, 0, speed_pid_p);
    _mav_put_int16_t(buf, 2, speed_pid_i);
    _mav_put_int16_t(buf, 4, speed_pid_d);
    _mav_put_int16_t(buf, 6, stable_pid_p);
    _mav_put_int16_t(buf, 8, stable_pid_i);
    _mav_put_int16_t(buf, 10, stable_pid_d);

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SET_PID_ALT_LEN);
#else
    mavlink_set_pid_alt_t packet;
    packet.speed_pid_p = speed_pid_p;
    packet.speed_pid_i = speed_pid_i;
    packet.speed_pid_d = speed_pid_d;
    packet.stable_pid_p = stable_pid_p;
    packet.stable_pid_i = stable_pid_i;
    packet.stable_pid_d = stable_pid_d;

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SET_PID_ALT_LEN);
#endif

    msg->msgid = MAVLINK_MSG_ID_SET_PID_ALT;
    return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_SET_PID_ALT_MIN_LEN, MAVLINK_MSG_ID_SET_PID_ALT_LEN, MAVLINK_MSG_ID_SET_PID_ALT_CRC);
}

/**
 * @brief Encode a set_pid_alt struct
 *
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 * @param set_pid_alt C-struct to read the message contents from
 */
static inline uint16_t mavlink_msg_set_pid_alt_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_set_pid_alt_t* set_pid_alt)
{
    return mavlink_msg_set_pid_alt_pack(system_id, component_id, msg, set_pid_alt->speed_pid_p, set_pid_alt->speed_pid_i, set_pid_alt->speed_pid_d, set_pid_alt->stable_pid_p, set_pid_alt->stable_pid_i, set_pid_alt->stable_pid_d);
}

/**
 * @brief Encode a set_pid_alt struct on a channel
 *
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param chan The MAVLink channel this message will be sent over
 * @param msg The MAVLink message to compress the data into
 * @param set_pid_alt C-struct to read the message contents from
 */
static inline uint16_t mavlink_msg_set_pid_alt_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_set_pid_alt_t* set_pid_alt)
{
    return mavlink_msg_set_pid_alt_pack_chan(system_id, component_id, chan, msg, set_pid_alt->speed_pid_p, set_pid_alt->speed_pid_i, set_pid_alt->speed_pid_d, set_pid_alt->stable_pid_p, set_pid_alt->stable_pid_i, set_pid_alt->stable_pid_d);
}

/**
 * @brief Send a set_pid_alt message
 * @param chan MAVLink channel to send the message
 *
 * @param speed_pid_p  speed_pid_p
 * @param speed_pid_i  speed_pid_i
 * @param speed_pid_d  speed_pid_d
 * @param stable_pid_p  stable_pid_p
 * @param stable_pid_i  stable_pid_i
 * @param stable_pid_d  stable_pid_d
 */
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS

static inline void mavlink_msg_set_pid_alt_send(mavlink_channel_t chan, int16_t speed_pid_p, int16_t speed_pid_i, int16_t speed_pid_d, int16_t stable_pid_p, int16_t stable_pid_i, int16_t stable_pid_d)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_SET_PID_ALT_LEN];
    _mav_put_int16_t(buf, 0, speed_pid_p);
    _mav_put_int16_t(buf, 2, speed_pid_i);
    _mav_put_int16_t(buf, 4, speed_pid_d);
    _mav_put_int16_t(buf, 6, stable_pid_p);
    _mav_put_int16_t(buf, 8, stable_pid_i);
    _mav_put_int16_t(buf, 10, stable_pid_d);

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_PID_ALT, buf, MAVLINK_MSG_ID_SET_PID_ALT_MIN_LEN, MAVLINK_MSG_ID_SET_PID_ALT_LEN, MAVLINK_MSG_ID_SET_PID_ALT_CRC);
#else
    mavlink_set_pid_alt_t packet;
    packet.speed_pid_p = speed_pid_p;
    packet.speed_pid_i = speed_pid_i;
    packet.speed_pid_d = speed_pid_d;
    packet.stable_pid_p = stable_pid_p;
    packet.stable_pid_i = stable_pid_i;
    packet.stable_pid_d = stable_pid_d;

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_PID_ALT, (const char *)&packet, MAVLINK_MSG_ID_SET_PID_ALT_MIN_LEN, MAVLINK_MSG_ID_SET_PID_ALT_LEN, MAVLINK_MSG_ID_SET_PID_ALT_CRC);
#endif
}

/**
 * @brief Send a set_pid_alt message
 * @param chan MAVLink channel to send the message
 * @param struct The MAVLink struct to serialize
 */
static inline void mavlink_msg_set_pid_alt_send_struct(mavlink_channel_t chan, const mavlink_set_pid_alt_t* set_pid_alt)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    mavlink_msg_set_pid_alt_send(chan, set_pid_alt->speed_pid_p, set_pid_alt->speed_pid_i, set_pid_alt->speed_pid_d, set_pid_alt->stable_pid_p, set_pid_alt->stable_pid_i, set_pid_alt->stable_pid_d);
#else
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_PID_ALT, (const char *)set_pid_alt, MAVLINK_MSG_ID_SET_PID_ALT_MIN_LEN, MAVLINK_MSG_ID_SET_PID_ALT_LEN, MAVLINK_MSG_ID_SET_PID_ALT_CRC);
#endif
}

#if MAVLINK_MSG_ID_SET_PID_ALT_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
  This varient of _send() can be used to save stack space by re-using
  memory from the receive buffer.  The caller provides a
  mavlink_message_t which is the size of a full mavlink message. This
  is usually the receive buffer for the channel, and allows a reply to an
  incoming message with minimum stack space usage.
 */
static inline void mavlink_msg_set_pid_alt_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan,  int16_t speed_pid_p, int16_t speed_pid_i, int16_t speed_pid_d, int16_t stable_pid_p, int16_t stable_pid_i, int16_t stable_pid_d)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char *buf = (char *)msgbuf;
    _mav_put_int16_t(buf, 0, speed_pid_p);
    _mav_put_int16_t(buf, 2, speed_pid_i);
    _mav_put_int16_t(buf, 4, speed_pid_d);
    _mav_put_int16_t(buf, 6, stable_pid_p);
    _mav_put_int16_t(buf, 8, stable_pid_i);
    _mav_put_int16_t(buf, 10, stable_pid_d);

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_PID_ALT, buf, MAVLINK_MSG_ID_SET_PID_ALT_MIN_LEN, MAVLINK_MSG_ID_SET_PID_ALT_LEN, MAVLINK_MSG_ID_SET_PID_ALT_CRC);
#else
    mavlink_set_pid_alt_t *packet = (mavlink_set_pid_alt_t *)msgbuf;
    packet->speed_pid_p = speed_pid_p;
    packet->speed_pid_i = speed_pid_i;
    packet->speed_pid_d = speed_pid_d;
    packet->stable_pid_p = stable_pid_p;
    packet->stable_pid_i = stable_pid_i;
    packet->stable_pid_d = stable_pid_d;

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_PID_ALT, (const char *)packet, MAVLINK_MSG_ID_SET_PID_ALT_MIN_LEN, MAVLINK_MSG_ID_SET_PID_ALT_LEN, MAVLINK_MSG_ID_SET_PID_ALT_CRC);
#endif
}
#endif

#endif

// MESSAGE SET_PID_ALT UNPACKING


/**
 * @brief Get field speed_pid_p from set_pid_alt message
 *
 * @return  speed_pid_p
 */
static inline int16_t mavlink_msg_set_pid_alt_get_speed_pid_p(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int16_t(msg,  0);
}

/**
 * @brief Get field speed_pid_i from set_pid_alt message
 *
 * @return  speed_pid_i
 */
static inline int16_t mavlink_msg_set_pid_alt_get_speed_pid_i(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int16_t(msg,  2);
}

/**
 * @brief Get field speed_pid_d from set_pid_alt message
 *
 * @return  speed_pid_d
 */
static inline int16_t mavlink_msg_set_pid_alt_get_speed_pid_d(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int16_t(msg,  4);
}

/**
 * @brief Get field stable_pid_p from set_pid_alt message
 *
 * @return  stable_pid_p
 */
static inline int16_t mavlink_msg_set_pid_alt_get_stable_pid_p(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int16_t(msg,  6);
}

/**
 * @brief Get field stable_pid_i from set_pid_alt message
 *
 * @return  stable_pid_i
 */
static inline int16_t mavlink_msg_set_pid_alt_get_stable_pid_i(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int16_t(msg,  8);
}

/**
 * @brief Get field stable_pid_d from set_pid_alt message
 *
 * @return  stable_pid_d
 */
static inline int16_t mavlink_msg_set_pid_alt_get_stable_pid_d(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int16_t(msg,  10);
}

/**
 * @brief Decode a set_pid_alt message into a struct
 *
 * @param msg The message to decode
 * @param set_pid_alt C-struct to decode the message contents into
 */
static inline void mavlink_msg_set_pid_alt_decode(const mavlink_message_t* msg, mavlink_set_pid_alt_t* set_pid_alt)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    set_pid_alt->speed_pid_p = mavlink_msg_set_pid_alt_get_speed_pid_p(msg);
    set_pid_alt->speed_pid_i = mavlink_msg_set_pid_alt_get_speed_pid_i(msg);
    set_pid_alt->speed_pid_d = mavlink_msg_set_pid_alt_get_speed_pid_d(msg);
    set_pid_alt->stable_pid_p = mavlink_msg_set_pid_alt_get_stable_pid_p(msg);
    set_pid_alt->stable_pid_i = mavlink_msg_set_pid_alt_get_stable_pid_i(msg);
    set_pid_alt->stable_pid_d = mavlink_msg_set_pid_alt_get_stable_pid_d(msg);
#else
        uint8_t len = msg->len < MAVLINK_MSG_ID_SET_PID_ALT_LEN? msg->len : MAVLINK_MSG_ID_SET_PID_ALT_LEN;
        memset(set_pid_alt, 0, MAVLINK_MSG_ID_SET_PID_ALT_LEN);
    memcpy(set_pid_alt, _MAV_PAYLOAD(msg), len);
#endif
}
